package club.caihappy;

import club.caihappy.config.AppConfig;
import club.caihappy.config.RootConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * Created by DELL on 2021/10/20
 **/
public class MyAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    //获取根容器的配置类;(Spring的配置文件) 父容器
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{RootConfig.class};
    }

    //获取Web容器的配置类 (SpringMVC配置文件) 子容器
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{AppConfig.class};
    }

    //获取DispatcherServlet的映射信息拦截除*.jsp外的所有请求，包括静态资源
    //如果写/*会拦截所有请求包括*.jsp
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
